package org.grottarossa.ui.core.casemanagement.bpm;

import org.grottarossa.template.data.pojo.table.Record;
import org.grottarossa.ui.core.ApplicationSession;
import org.grottarossa.ui.core.base.BasePanel;
import org.grottarossa.ui.core.layout.EmptyPanel;
import org.grottarossa.ui.core.layout.LayoutFactory;


import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;

public class ProcessManagementPanel extends BasePanel
{
	private VerticalLayout m_layout;

	public ProcessManagementPanel(ApplicationSession appSession, String layoutName, HorizontalLayout buttonsBar) throws Exception
	{
		super(appSession, null);
		initializeComponents();
		init(layoutName, buttonsBar);
	}

	private void init(String layoutName, HorizontalLayout buttonsBar) throws Exception
	{
		Record record;
		Component component;

		component = (Component) m_appSession.getLayoutFactory().createLayout(
				layoutName, new Class[] { Record.class, Layout.class},  new Object[] { null, buttonsBar } );

		component.setWidth(100, Sizeable.UNITS_PERCENTAGE);
		component.setHeight(100, Sizeable.UNITS_PERCENTAGE);

		m_layout.addComponent(component);
		m_layout.addComponent(buttonsBar);
		m_layout.setExpandRatio(component, 1000);
		m_layout.setExpandRatio(buttonsBar, 1);
	}

	@Override
	protected void initializeComponents()
	{
		m_layout = new VerticalLayout();
		m_layout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
		m_layout.setHeight(100, Sizeable.UNITS_PERCENTAGE);
		setLayout(m_layout);
	}
}
